package com.lengxf.minio.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "minio")
public class MinioProperties {

    private String endpoint;

    private String accessKey;

    private String secretKey;

    private String bucket;

    private Integer expire;


    public MinioClient client() {
        return MinioClient.builder()
                .endpoint(this.getEndpoint())
                .credentials(this.getAccessKey(), this.getSecretKey())
                .build();
    }

}
